hp_procurve_show_system: support VSF-stack standalone-line Serial Number#2309
hp_procurve_show_system: support VSF-stack standalone-line Serial Number#2309julmanglano wants to merge 3 commits into
Conversation
|
I'd like to merge the above mentioned PR, then rebase this PR against the current state. |
VSF-stack output emits one "Serial Number :" line per stack member with no preceding "ROM Version :" prefix on the same line. The existing combined regex matches only the first member; the new fallback captures each subsequent member's serial. Adds a 3-member-VSF fixture as regression coverage.
* Adjust contact and location line and capture group regex to accept empty values * Retain previous test data and move new test data to the third file
6a3e532 to
0425e94
Compare
|
@julmanglano
🎯 Please verify and test against a live device. Thank you! |
|
Thanks @mjbear Pulled the rebase and tested against my live 2-member VSF stack — the parse fails on real device output. System Contact wraps at column ~80 on HP procurve, and the orphan continuation hits ^. -> Error in the Start state, so the template is unusable against this device family as-is. Anonymised example of the failing input: A one-line swallow rule before Verified locally — with the rule, the parse produces 2 records (one per VSF member), chassis-level Filldown values populate correctly across both, and per-member fields are distinct. Trade-off: contact (and location if it wraps too) is truncated to the first line. Happy to push the fix to the branch — or you can apply it directly, whichever you prefer. (The three committed fixtures still pass.) |
Oh darn
Thank you for the visual example.
It's fifteen spaces today, but that could change -- it may be worth using a leading Maybe change the data regex to a repeating pattern and anchor on the end of the line? - ^\s{15,}\S
+# match long sys contact that wraps to next line
+ ^\s+\S+$$ |
|
Agree, again, like I said before. I can push the fix to the branch, or feel free to apply it yourself — whichever works best for you. |
|
@julmanglano |
…act/Location Long values wrap at column 78 and orphan continuations hit ^. -> Error. Add `^\s+\S.*$$` swallow above the catch-all to tolerate 1-, 2-, and 3+ line wraps with single- or multi-token continuations. Captured value is truncated to line 1. Exercise the 3-line case in hp_procurve_show_system3.
|
Thanks @mjbear — Wrap is at column 78 (2-char indent + 76 visible — standard 80-col terminal). Tested a third stack while building the fixture and hit a case Middle line has multiple tokens, so +# swallow wrap-continuation lines (long contact/location wrap at col 78)
+ ^\s+\S.*$$Covers all three shapes I've seen — 1-, 2-, and 3-line wraps, single- or multi-token continuations. Specific field rules earlier in Updated Pushed. |
| # swallow wrap-continuation lines (long contact/location wrap at col 78) | ||
| ^\s+\S.*$$ |
There was a problem hiding this comment.
Hmm, putting the location in the contact field (which is in the location field) is redundant. In my eyes these are self-induced problems.
From the test data, I see why you have this regex. The trade-off and risk is that this will match most lines.
@julmanglano Is there a legitimate reason why the location is also in the System Contact?
I'll ping other maintainers for some feedback.
One item that comes to my mind is to state transition for System Contact and cover it and System Location with this loose regex. Once those two are handled in that new state, then state transition back to Start state. This way we should reduce the risk of over-matching lines because of this Contact/Location stuff.
ISSUE TYPE
COMPONENT
hp_procurve,
show systemSUMMARY
The current template captures
Serial Numberonly when it appears on thesame line as
ROM Version:That holds for standalone HP ProCurve switches, but VSF-stack output
splits each member's metadata across separate lines:
Result: on a stacked switch,
serialparses as the first-member's serialonly (or empty, depending on stack config), and the per-member serials
are silently dropped.
This PR adds an additional rule that captures
Serial Numberon its ownline, falling through the existing combined rule when present:
SERIALis a single-value (not List), so on stacks the captured value isthe last member's serial — mirroring the device's own behavior of only
exposing one serial in
show systemfor stacked output. No schemachange; existing fixtures unaffected.
The new
hp_procurve_show_system2.{raw,yml}fixture covers a 3-memberVSF stack and exercises the new fallback rule.